/*
 * @Author: y001554
 * @Date: 2023-01-16 20:11:08
 * @LastEditors: y001554
 * @LastEditTime: 2023-06-13 11:41:17
 * @FilePath: \ylwl\packages\plugins\components\table\src\type.ts
 * @Description:
 *
 * Copyright (c) 2023 by FE/ylwl, All Rights Reserved.
 */
import type { PropType, ExtractPropTypes } from 'vue'
import { CUSTOMER_PROPS,  } from './composables/setting'
// import type { FormItemProps, InputProps } from 'element-plus'

export interface ModalItems {
  label: string
  permission?: Function
  kayName: string 
  iProps?: any 
  [key: string]: any
}
export interface ActionsItems {
  label: string
  type:string
  permission?: Function
  onclick?: Function
  [key: string]: any
}
export interface Items {
  [key: string]: any
}
 
 
export interface CustomerProps {
   showCheck?: boolean //  显示多选
  showIndex?: boolean //  显示自动序号
  showExpand?: boolean //显示树状图炸开下标
  pagination?: Object    //分页选项
  showPagination?:true
  manualLoad?: boolean //是否自动加载一次数据
  scrollListen?: boolean //是否开启滚动监听
}

export interface FormObj {
  [key: string]: any
}
 
export type ItemData = Array<Items>
export type ModalData = Array<ModalItems>
export type ActionsData = Array<ActionsItems>

export const componentProps = {
  extra:{
    type: Object as PropType<FormObj>  ,
    default: () => ({})
  },
  //@备注:列表列配置
  //@取值:
  tableModal: {
    type: Array as PropType<ModalData>,
    default: () => []
  },
  //@备注:按钮配置
  //@取值:
  actionsModal: {
    type: Array as PropType<ActionsData>,
    default: () => []
  },
  //@备注:自定义属性
  //@取值:
  customerProps: {
    type: Object as PropType<CustomerProps>,
    default: () => ({
      ...CUSTOMER_PROPS
    })
  },
  //@备注:请求体
  //@取值:
  request: {   
    type: Function,
    required: true
  },
  //@备注:双向绑定  选择纸
  //@取值:
  modelValue: {
    type:Array<any>,
    default: []
  },
} as const

export type ComponentProps = ExtractPropTypes<typeof componentProps>
